﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Data.Services.Common;

namespace Service.Model
{
	[DataServiceKey(new[] { "ID", "StateID" })]
	[Table("County")]
    [FederationKey("StateID")]
	public class County
	{
        internal DbContext DbContext { get; set; }

		[Key]
		[Column(Order=0)]
		public Int64 ID { get; set; }
		[Key]
		[Column(Order=1)]
		public Int64 StateID { get; set; }
		public string Name { get; set; }

		[ForeignKey("StateID")]
		[InverseProperty("Counties")]
		public State State { get; set; }

		[InverseProperty("County")]
		public ICollection<City> Cities { get; set; }
	}
}